<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://eureka.yigolden.net/stringutils/sutaglib/1.0" prefix="su"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录</title>
<link type="text/css" href="${staticResources}/css/login.css" rel="stylesheet" />
<script type="text/javascript" src="${staticResources}/js/ajax.js"></script>


<script type="text/javascript">

function check()
{
	var staffid = document.getElementById("login").value;
	var password = document.getElementById("password").value;
	var redirect_url = document.getElementById("redirect_url").value;
	var mode = "ajax";
	
	var params="staffid=" + encodeURIComponent(staffid);
	params+="&password="+encodeURIComponent(password);
	params+="&redirect_url="+encodeURIComponent(redirect_url);
	params+="&mode="+encodeURIComponent(mode);
	
	
	var checkid=document.getElementById("checkid");
	
	
	if(staffid.length<7) {
		checkid.innerHTML="<font color='red'> 用户名不可少于7个字符</font>";
		return;
	}
	
	 if(password.length<6) {
		 checkid.innerHTML="<font color='red'> 密码不可少于6个字符</font>";
		 return;
	 }
	 doAjax("Login"
				,params,function(rst){
		var rst=eval('(' +rst+ ')');
		if (rst.status == 2)
			{
			checkid.innerHTML = "<font color='red'>用户不存在</font>";
			return;
			}
		if (rst.status == -1)
		{
		checkid.innerHTML = "<font color='red'>参数错误</font>";
		return;
		}
		if (rst.status == 1)
		{
		checkid.innerHTML = "<font color='red'>密码错误</font>";
		return;
		}
		
		location.href = rst.redirectURL;
		
			
		})
	
}




</script>

</head>
<body>

    <div id="header">
	      <div id="logo"><img src="${staticResources}/image/_login_03.gif" width="553" height="84" alt=""></div>
	</div>
	<div class="main">
	       <div id="lmain"><img src="${staticResources}/image/_login_07.gif" width="400" height="370" alt=""></div>
		   <div id="rmain">
		         <dl class="words"><img src="${staticResources}/image/_login_10.gif" width="150" height="41" alt=""></dl>
				 
				 
	 <form method="post" name="frmLogin" action="Login" onsubmit="check();return false;">
		
		
			
			<div class="clear"></div>
			<label for="login">学号：</label>
			<input type="text" id="login" style="width:300px; height:35px; margin::20px 25px 20px 5px;"name="staffid" placeholder="学工号"/>
			<div class="clear"></div>
			
			<label for="password">密码：</label>
			<input type="password" id="password" style="width:300px; height:35px; margin::20px 25px 20px 5px;"id="password" name="password" placeholder="密码"/>
			
			<div id="checkid"></div>
			
			<div class="clear"></div>
			<div class="loseno"><a href="RestorePassword">忘记密码？</a></div>
			
			
			<div class="botton1"><input type="image" style=" margin-left:50px;"src="${staticResources}/image/_login_14.gif" width="300" height="35" alt="" class="button" name="commit" value="登录"/></div>
			<div class="clear2"></div>
			
			<a href="Register" type="submit" style="margin: -10px 200px 0px 310px;" class="button" name="commit" value="注册"><img src="${staticResources}/image/login_03.gif" width="50" height="25" alt=""></a>
		<input type="hidden" name="redirect_url" id="redirect_url" value="${su:encodeLink(param.redirect_url) }" />
	</form>

				
		   </div>
	</div>

</body>
</html>